/*  1:   */ package tt.dz.web.controller.financial;
/*  2:   */ 
/*  3:   */ import com.alibaba.fastjson.JSON;
/*  4:   */ import java.util.ArrayList;
/*  5:   */ import java.util.List;
/*  6:   */ import javax.annotation.Resource;
/*  7:   */ import javax.servlet.http.HttpServletRequest;
/*  8:   */ import javax.servlet.http.HttpServletResponse;
/*  9:   */ import org.apache.commons.collections.CollectionUtils;
/* 10:   */ import org.springframework.stereotype.Controller;
/* 11:   */ import org.springframework.web.bind.annotation.RequestMapping;
/* 12:   */ import org.springframework.web.bind.annotation.ResponseBody;
/* 13:   */ import tt.dz.biz.service.financial.ChannelBankAccountService;
/* 14:   */ import tt.dz.common.LogUtil;
/* 15:   */ import tt.dz.vo.ChannelBankaccountVO;
/* 16:   */ import tt.dz.vo.ResponseModle;
/* 17:   */ import tt.dz.web.controller.BaseController;
/* 18:   */ 
/* 19:   */ @Controller
/* 20:   */ public class ChannelBankAccountController
/* 21:   */   extends BaseController
/* 22:   */ {
/* 23:   */   @Resource(name="channelBankAccountService")
/* 24:   */   private ChannelBankAccountService channelBankAccountService;
/* 25:   */   
/* 26:   */   @RequestMapping(value={"/listAllChannelSubject"}, produces={"application/json;charset=UTF-8"})
/* 27:   */   @ResponseBody
/* 28:   */   public String listAllChannelSubject()
/* 29:   */   {
/* 30:36 */     ResponseModle responseModle = null;
/* 31:   */     try
/* 32:   */     {
/* 33:38 */       List<ChannelBankaccountVO> channelBankaccountList = this.channelBankAccountService.listAllChannelSubject();
/* 34:39 */       responseModle = new ResponseModle("success", channelBankaccountList);
/* 35:   */     }
/* 36:   */     catch (Exception e)
/* 37:   */     {
/* 38:41 */       LogUtil.error("查询渠道对应银行科目下的二级账户异常", e);
/* 39:42 */       responseModle = new ResponseModle("error", new ArrayList());
/* 40:   */     }
/* 41:44 */     return JSON.toJSONString(responseModle);
/* 42:   */   }
/* 43:   */   
/* 44:   */   @RequestMapping(value={"/modifyChannelSubject"}, produces={"application/json;charset=UTF-8"})
/* 45:   */   @ResponseBody
/* 46:   */   public String modifyChannelSubject(HttpServletRequest request, HttpServletResponse response)
/* 47:   */   {
/* 48:57 */     boolean excuteFlag = false;
/* 49:   */     try
/* 50:   */     {
/* 51:59 */       String modifyType = request.getParameter("modifyType");
/* 52:60 */       ChannelBankaccountVO channelBankaccountVO = (ChannelBankaccountVO)JSON.parseObject(request.getParameter("channelBankaccountVO"), ChannelBankaccountVO.class);
/* 53:61 */       List<ChannelBankaccountVO> existChannelBankAccountList = this.channelBankAccountService.queryChannelBankAccountBychannelCode(channelBankaccountVO.getChannelCode());
/* 54:62 */       if ("insert".equals(modifyType))
/* 55:   */       {
/* 56:63 */         if (CollectionUtils.isNotEmpty(existChannelBankAccountList)) {
/* 57:64 */           return JSON.toJSONString(assemblyResponseData(false, "该渠道已设置了对应银行存款科目。"));
/* 58:   */         }
/* 59:66 */         excuteFlag = this.channelBankAccountService.insertChannelSubject(channelBankaccountVO);
/* 60:   */       }
/* 61:67 */       else if ("update".equals(modifyType))
/* 62:   */       {
/* 63:68 */         excuteFlag = this.channelBankAccountService.updateChannelSubject(channelBankaccountVO);
/* 64:   */       }
/* 65:   */     }
/* 66:   */     catch (Exception e)
/* 67:   */     {
/* 68:71 */       LogUtil.error("更改渠道对应银行科目下的二级账户异常", e);
/* 69:72 */       return JSON.toJSONString(assemblyResponseData(false, "系统繁忙，请稍后再试。"));
/* 70:   */     }
/* 71:74 */     return JSON.toJSONString(assemblyResponseData(excuteFlag, null));
/* 72:   */   }
/* 73:   */ }


/* Location:           F:\work\pengyu\mainServer\WEB-INF\classes\
 * Qualified Name:     tt.dz.web.controller.financial.ChannelBankAccountController
 * JD-Core Version:    0.7.0.1
 */